<?php

namespace app\index\controller;

use app\index\model\Login;
use think\Session;

class Logins{

    function index(){
        $Login = new Login();
        try{
            $user = $Login->login();
            $accessUrls = $Login->getAccessUrls($user['role_id']);
            $menuData = $Login->getMenuData($user['role_id']);
            Session::set('user',$user);
            Session::set('accessUrls',$accessUrls);
            return ['status'=>true,'menuData'=>$menuData];
        }catch (\Exception $e){
            return ['status'=>false,'error'=>$e->getMessage()];
        }
    }
}
